<?php
     /*  
         * ======================================================================================
         * 
         * ALL the Zend_Forms classes performed by Jean Carlo Machado has the following scope:
         * 
         * public function init(); 
         * public function showForm($name,$destinationUrl);
         * 
         * The first one serves only to zend authenticate the fom         * 
         * The second one serves to show the form without use Zend patters
         * of forms. 
         * 
         * =======================================================================================
         * To call on the controllers or helpers scope:
         * 
         *      To show:
         *              require_once APPLICATION_PATH . '/forms/Forms_CriarNodo.php';
                        $form = new Forms_CriarNodo();
                        $form->setAction($this->_helper->url('recivecreatenod'));
                        $form->showForm('create','/nodo/recivecreatenod');
         * 
         *      To pick back (IN THE ACTION PASSED TO SHOW FORM):
         *                  require_once APPLICATION_PATH . '/forms/Forms_CriarNodo.php';
                            $form = new Forms_CriarNodo();

                            if($this->getRequest()->isPost())
                            {
                                $data = $this->_request->getPost();

                                print_r($data);

                                if($form->isValid($data))
                                {
                                   //DO SOMETHING
                                }
                                else
                                {
                                     $this->view->message = 'Dados Invalidos';
                                }
         * =========================================================================================
         * 
         */

    class Forms_HiddenInfo
    {
        
        public function initialize($name,$destinationUrl,$hiddenParameters)
        {
            /*Form padrao para a realiza?ao de a??es
         * seus parametros s?o 2
         * 'action' => 'delete','create','insert','etc'
         * 'name' => 'nomeDoCampoEmQuestao'
         * 
         * suporta array de objetos
        */
            $content = "<form name='$name' method='POST' action='$destinationUrl'>";
            if(is_array($hiddenParameters))
            {
                foreach($hiddenParameters as $id => $obj)
                {
                    if(is_array($obj))
                        foreach($obj as $id => $val)
                        {
                            $content.="<input type='hidden' name='$id' value='$val'>";
                        }
                     else if($obj != "")
                        $content.="<input type='hidden' name='$id' value='$obj'>";
                }
            }
           $content.="<input type='submit' name='$name' value='$name'>";
           $content.="</form>";

            return $content;
        }
    }
?>
